#!/bin/bash

service=`kubectl -n capacity get pods | grep cooperative-govern|wc -l`
echo '$service'
for((i=1;i<=$service;i++));
    do
    servicename=`kubectl -n capacity get pods | grep event-trigger| awk 'NR==$i{print $l}'`

    for((i=1;i<=10;i++));
        do
          time=`printf "%02d\n" $i`
          tota1=`kubectl -n capacity -it exec event-trigger-service-provider-7f6bf85f88-9wgm9 cat logs/info.2020-07-01.log |grep '事件存储告警处理结果'|grep '2020-07-01 '$time |wc -l`
          tota2=`kubectl -n capacity -it exec event-trigger-service-provider-7f6bf85f88-kvsdm cat logs/info.2020-07-01.log |grep '事件存储告警处理结果'|grep '2020-07-01 '$time |wc -l`
          t=`expr $tota1 + $tota2`
          succ1=`kubectl -n capacity  -it exec event-trigger-service-provider-7f6bf85f88-9wgm9 cat logs/info.2020-07-01.log |grep '事件存储告警处理结果'|grep 'filePath' |grep '2020-07-01 '$time |wc     -l`
          succ2=`kubectl -n capacity  -it exec event-trigger-service-provider-7f6bf85f88-kvsdm cat logs/info.2020-07-01.log |grep '事件存储告警处理结果'|grep 'filePath' |grep '2020-07-01 '$time |wc     -l`
          s=`expr $succ1 + $succ2`
          echo '服务名称:'$servicename ' '时间段:'$time ' 总量:' $t ' ;成功量:' $s
          r=`echo "scale=3; $s/$t" | bc`
          echo '时间段:'$time' 成功率': '0'$r
          echo '------------------------------'
        done
done
done


for(( i=0;i<${#totalarr1[@]}$;i++))
     do
     echo ${totalarr1[i]};

     done;

for i in "${totalarr2[@]}";
do
b=($i)
for j in "${b[@]}";
do

done
done



